﻿<%@ Page Title="Formularz zgłoszeniowy" Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master"
    AutoEventWireup="true" CodeBehind="EntryFormAdmin.aspx.cs" Inherits="Marta.buchalska.wesele.EntryFormAdmin" %>

<asp:Content ID="Content2" ContentPlaceHolderID="adminBody" runat="server">
    <asp:UpdatePanel runat="server" ID="uppln">
        <ContentTemplate>
            <div id="MainContent_adminBody_formEnrty">
                <div>
                    <span>Pola zdefiniowane przez z użytkownika: </span>
                    <asp:GridView ID="TabListGridView" GridLines="None" runat="server" AutoGenerateColumns="False"
                        CssClass="admi_entryForm_TabList" DataSourceID="TabsDataSource" DataKeyNames="ID"
                        OnRowDeleting="TabListGridView_RowDeleting">
                        <EmptyDataRowStyle />
                        <EmptyDataTemplate>
                            <span>Brak elementów do wyświetlenia</span>
                        </EmptyDataTemplate>
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" SelectText="Szczegóły" />
                            <asp:BoundField DataField="Name" SortExpression="Name" />
                            <asp:CommandField ShowDeleteButton="true" DeleteText="Usuń" />
                        </Columns>
                        <SelectedRowStyle BorderColor="ActiveBorder" />
                    </asp:GridView>
                    <asp:DetailsView ID="DetailsView1" CssClass="admi_entryForm_addNew" runat="server"
                        DefaultMode="Insert" DataSourceID='TabsDataSource' AutoGenerateRows="False">
                        <Fields>
                            <asp:BoundField DataField='Name' HeaderText='Nazwa dla nowej zakładki zakładki : ' />
                            <asp:CommandField CancelText="Anuluj" InsertText="Zapisz" ShowInsertButton="True" />
                        </Fields>
                    </asp:DetailsView>
                </div>
                <div>
                    <asp:DetailsView ID="InsertItemDetailView" runat="server" AutoGenerateRows="False"
                        DefaultMode="Insert" DataSourceID="entryFormItemsSourceData" Height="50px" Width="352px"
                        OnLoad="InsertItemDetailView_Load" DataKeyNames="ID">
                        <Fields>
                            <asp:TemplateField HeaderText="Nazwa : " SortExpression="Name">
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Typ elementu :">
                                <InsertItemTemplate>
                                    <asp:LinqDataSource ID="ItemTypesDataSource" runat="server" ContextTypeName="Marta.buchalska.wesele.DataModel.WeedingDBDataContext"
                                        EntityTypeName="" Select="new (Type, Description, ID)" TableName="entry_form_items_types">
                                    </asp:LinqDataSource>
                                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID='ItemTypesDataSource'
                                        DataTextField='Type' DataValueField='ID' OnLoad="InsertItemType_Load">
                                    </asp:DropDownList>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowInsertButton="true" CancelText="Anuluj" InsertText="Zapisz" />
                        </Fields>
                    </asp:DetailsView>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="entryFormItemsSourceData"
                        CssClass="admi_entryForm_TabList" DataKeyNames="ID" ShowHeader="false">
                        <EmptyDataTemplate>
                            Brak elementów do wyswietlenia
                        </EmptyDataTemplate>
                        <Columns>
                            <asp:BoundField DataField="Name" SortExpression="Name" />
                            <asp:CommandField ShowDeleteButton="true" DeleteText="Usuń" />
                            <asp:CommandField ShowEditButton="true" EditText="Edytuj" UpdateText="Zapisz" CancelText="Anuluj" />
                        </Columns>
                    </asp:GridView>
                </div>
            </div>
            <asp:LinqDataSource ID="TabsDataSource" runat="server" ContextTypeName="Marta.buchalska.wesele.DataModel.WeedingDBDataContext"
                TableName="Entry_form_tabs" EnableDelete="True" EnableInsert="True" EnableUpdate="True"
                EntityTypeName="">
            </asp:LinqDataSource>
            <asp:LinqDataSource ID="entryFormItemsSourceData" runat="server" ContextTypeName="Marta.buchalska.wesele.DataModel.WeedingDBDataContext"
                EntityTypeName="" EnableDelete="true" EnableUpdate="true" EnableInsert="True"
                TableName="Entry_form_items" Where="Entry_form_tab_id = Int32?(@entry_form_tab_id)"
                OnInserting="entryFormItemsSourceData_Inserting">
                <WhereParameters>
                    <asp:ControlParameter ControlID='TabListGridView' PropertyName='SelectedValue' Name='entry_form_tab_id' />
                </WhereParameters>
            </asp:LinqDataSource>
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
